/*
* Copyright (c) 2011 Connection Road.  All rights reserved.
* This program and the accompanying material are made available
* under the terms of the Eclipse Public Licnese v1.0 which is
* available at http://www.eclipse.org/legal/epl-v10.html
*/

using System.Drawing;
using System.Windows.Forms;

namespace WProgressBar
{
    public partial class WBlueProgressBar : UserControl
    {
        public WBlueProgressBar()
        {
            InitializeComponent();

            _defaultImageHeight = PanelBlue.Size.Height;
            _defaultImageWidth = PanelBlue.Size.Width;
            _defaultLocation = PanelBlue.Location;
        }

        private int _defaultImageHeight;
        private int _defaultImageWidth;
        private Point _defaultLocation;

        public void SetFraction(double fraction)
        {
            var percentInFraction = fraction / 100;
            var length = percentInFraction * _defaultImageWidth;
            PanelBlue.Size = new Size((int)length, _defaultImageHeight);
        }

        public string ProgressInfo
        {
            set
            {
                LabelProgressText1.Text = value;
                LabelProgressText2.Text = value;
            }

            get { return LabelProgressText1.Text; }
        }
    }
}
